package com.dsg.workflow;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dsg.entity.apply.DsgApplyCard;
import com.dsg.entity.apply.DsgApplyStatus;
import com.dsg.entity.approve.DsgApproveCase;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 更改油咭限額
 */
@Service
public class WorkflowService12 extends AbstractWorkflowService {
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void uploadFormFillBack(DsgApproveCase approveCase) {
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("APP_NO", approveCase.getAppNo());
        DsgApplyStatus status = statusService.getOne(wrapper);
        status.setIsForm(DsgApplyStatus.AppStatus.yes.getCode());
        statusService.updateById(status);

        DsgApplyCard card = cardService.getById(status.getCardId());
        card.setLimitStatus(DsgApplyCard.LIMIT_STATUS_1);
        cardService.updateById(card);
    }
}
